package com.oto.client;

import java.io.IOException;

import com.oto.api.DataService;
import com.oto.bean.Account;
import com.oto.bean.Flow;
import com.oto.bean.Pack;
import com.oto.message.Response;
import com.oto.message.ShareMessage;

/**
 * Test Client
 * 
 * @author xueqiang.mi
 * @since 2011-1-9
 */
public class DataServiceClient {

	public static void main(String[] args) throws IOException {
		String url = OTOServiceFactory.SERVICE_URL + "dataService";
		DataService service = OTOServiceFactory.getService(DataService.class, url);

		ShareMessage msg = new ShareMessage();
		Pack pk = new Pack();
		pk.setName("test");
		pk.getFlows().add(new Flow("中国移动", "10086"));
		pk.getFlows().add(new Flow("中国联通", "10010"));
		msg.setPack(pk);
		msg.setOwner(new Account("xueqiang.mi@gmail.com", "google.com"));
		Response resp = service.share(msg);
		System.out.println(resp.getResult());
	}
}
